package com.example.wx.config;

import com.github.wxpay.sdk.WXPayConfig;

import java.io.InputStream;

public class WxConfig implements WXPayConfig
{
    private byte[] certData;

    /**
     * 获取 App ID
     *
     * @return App ID
     */
    @Override
    public String getAppID()
    {
        return "wxf34ab2bf69961028";
    }

    /**
     * 获取 Mch ID
     *
     * @return Mch ID
     */
    @Override
    public String getMchID()
    {
        return "1569666601";
    }


    /**
     * 获取 API 密钥
     *
     * @return API密钥
     */
    @Override
    public String getKey()
    {
        return "XWW320324199706273717xdWRHYDlsbh";
    }

    /**
     * 获取商户证书内容
     * 这里是读取resources根目录下面的证书文件
     *
     * @return 商户证书内容
     */
    @Override
    public InputStream getCertStream()
    {
        InputStream certStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("apiclient_cert.p12");
        return certStream;
    }

    @Override
    public int getHttpConnectTimeoutMs()
    {
        return 8000;
    }

    @Override
    public int getHttpReadTimeoutMs()
    {
        return 10000;
    }
}
